<!--/****⽣成⽇期: 2024-11-29 14:40:59****/-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>navigation</title>
    <style>
        * {
          padding: 0;
          margin: 0;
        }
        #container {
          width: 100%;
          height: 100vh;
          background-color: '#F4F4F4';
        }
    </style>
    <script type="text/javascript">
        window._AMapSecurityConfig = {
          securityJsCode: 'eb1e383cd89c9aa0c535f5263545c029',
        }
    </script>
    <script type="text/javascript"
            src="https://webapi.amap.com/maps?v=1.4.15&key=621ba3758298ae697c0b6ca59224d157"></script>
</head>

<body>
<div id="container"></div>

<script type="text/javascript">
    var map = new AMap.Map('container', {
      zoom: 15,
      center: [117.209108, 39.086017],
    })

    map.setZoomAndCenter(10, [116.487971, 39.836983])

    function beginDriving(start, end) {
      if (window.xiaoshi) {
        window.xiaoshi.alert('在html中,beginDriving开始执行了...')
      }

      AMap.plugin('AMap.Driving', () => {
        var driving = new AMap.Driving({
          policy: AMap.DrivingPolicy.LEAST_TIME,
          map,
        })
        var points = [{ keyword: start }, { keyword: end }]
        driving.search(points, (status, result) => {
          // 末出错时 result就是对应的路线规划方案
        })
      })
    }
  //   beginDriving('天津南站', '固安剑桥郡4期')
</script>
</body>
</html>
